package xuhaijia.lanou3g.autohome.recommend;
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//                  \./                   \\`.
//        .'//            为什么坚持  想一想当初             \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-.  \\`.
//    .'//.-"                 `-.  |  .-'                 "-. \\`.
//  .'//______.============-..   \ | /   ..-============._______\\`.
//.'//____________________________\|/_____________________________\\`.
// 
//                             

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import xuhaijia.lanou3g.autohome.base.URLValues;
import xuhaijia.lanou3g.autohome.recommend.bulletin.BulletinFragment;
import xuhaijia.lanou3g.autohome.recommend.newest.NewestFragment;
import xuhaijia.lanou3g.autohome.recommend.recommendreusing.RecSameFragment;
import xuhaijia.lanou3g.autohome.recommend.originalvideo.OriVideoFragment;
import xuhaijia.lanou3g.autohome.forum.forumreusing.ListViewFragment;
import xuhaijia.lanou3g.autohome.recommend.talker.TalkerFragment;
import xuhaijia.lanou3g.autohome.recommend.video.VideoFragment;

/**
 * Created by 7 on 16/8/18.
 */
public class RecommendAdapater extends FragmentPagerAdapter {
    String[] strings = new String[]{"最新", "快报", "视频", "新闻", "评测", "导购", "行情", "用车", "技术", "文化",
            "改装", "游记", "原创视频", "说客"};

    final String url[] = {URLValues.NEW_URL, URLValues.BULLETIN_URL, URLValues.VIDEO_URL, URLValues.NEWS_URL
            , URLValues.REVIEW_URL, URLValues.SHOPPERS_URL, URLValues.MARKET_URL, URLValues.THE_CAR_URL, URLValues.TECHNOLOGY_URL
            , URLValues.CULTURE_URL, URLValues.MODIFIED_URL, URLValues.TRAVEL_URL, URLValues.ORIGINAL_VIDEO_URL, URLValues.LOBBYISTS_URL};
    Fragment[] fragments;

    public RecommendAdapater(FragmentManager fm) {
        super(fm);
        fragments = new Fragment[strings.length];
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 0) {
            fragments[0] = new NewestFragment();
        } else if (position == 1) {
            fragments[1] = new BulletinFragment();
        } else if(position == 2 ) {
            fragments[2] = new VideoFragment();
        } else if(position == 12 ) {
            fragments[12] = new OriVideoFragment();
        } else if(position == 13 ) {
            fragments[13] = new TalkerFragment();
        }
         else {
            fragments[position] = RecSameFragment.getInstance(url[position]);
        }
        return fragments[position];
    }

    @Override
    public int getCount() {
        return strings.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return strings[position];
    }
}
